var max=0;function AsylumNavLink(parentId,linkId,order,href,linkText,target,width)
{this.linkId=linkId;this.parentId=parentId;this.order=order;this.href=href;this.linkText=linkText;this.target=target;this.width=width;};function AsylumNav(contId,layout,offset)
{this.menuCont=document.getElementById(contId);this.layout=layout;this.offset=(typeof offset=='undefined'?'Right':offset);this.menuItems=new Object();this.clickUnderCreated=false;};AsylumNav.prototype.AddLink=function(parentId,linkId,order,href,linkText,target,width)
{if(typeof this.menuItems[parentId]=='undefined')
{this.menuItems[parentId]=new Object();}
if(typeof width=="undefined")width=false;this.menuItems[parentId][linkId]=new AsylumNavLink(parentId,linkId,order,href,linkText,target,width);if(order>max){max=order;}};AsylumNav.prototype.CreateLevel=function(levelId,idPrefix)
{obj=this;div=document.createElement('div');div.id=idPrefix+levelId;div.levelId=levelId;div.idPrefix=idPrefix;div.className='levelDiv';div.onmouseout=function(e){obj.HideLevel(e);};div.subLevels=new Object();if(levelId!='0')
{div.style.visibility='hidden';div.className+=' subLevel';div.style.position='absolute';}
else
{div.className+=' topLevel';}
if(this.layout=='Horizontal')
{div.style.position='absolute';}
div.style.zIndex=10;if(this.menuCont){this.menuCont.appendChild(div);}
for(i=0;i<=max;i++){for(linkId in this.menuItems[levelId]){if(this.menuItems[levelId][linkId].order==i){linkDiv=document.createElement('div');linkDiv.id='asylumNavLinkDiv'+linkId;linkDiv.linkId=linkId;linkDiv.levelId=levelId;linkDiv.className='linkDiv';if(levelId=="0"){linkDiv.className+=" topLevel";if(this.menuItems[levelId][linkId].width){linkDiv.style.width=this.menuItems[levelId][linkId].width+"px";}}
div.appendChild(linkDiv);navLink=this.menuItems[levelId][linkId];a=document.createElement('a');a.id='asylumNavLink'+linkId;a.linkType='navMenu';a.linkId=linkId;a.levelId=navLink.parentId;a.parentId=navLink.parentId;if(navLink.href==''||navLink.href=='#')
{a.href='#';a.target='';a.style.cursor='default';}
else
{a.href=navLink.href;a.target=navLink.target;}
if(this.layout=='Vertical')
{a.innerHTML=navLink.linkText;}
else
{a.innerHTML=navLink.linkText.split(' ').join('&nbsp;');}
a.onmouseover=function(){obj.ShowLevel(this);};linkDiv.appendChild(a);if(linkId==pageId)
{a.className='activeLink';linkDiv.className+=' activeLink';topLink=this.GetTopLevelLink(navLink);if(typeof this.menuItems[topLink.linkId]!='undefined'&&navLink.levelId!='0')
{try{document.getElementById('asylumNavLink'+topLink.linkId).className+=' activeLink';document.getElementById('asylumNavLinkDiv'+topLink.linkId).className+=' activeLink';}catch(e){}}
if(document.getElementById("clickUnder")!=null)
{this.CreateClickUnder(topLink,true);}}
else
{}
if(typeof this.menuItems[linkId]!='undefined')
{div.subLevels[linkId]=true;}}}}
return div;};AsylumNav.prototype.Construct=function()
{if(this.menuCont==null){return;}
var obj=this;for(levelId in this.menuItems)
{this.CreateLevel(levelId,'asylumNavLevel');}
if(this.layout=='Vertical')
{if(typeof document.getElementById('tplMainSectors')!=null)
{ms=document.getElementById('tplMainSectors');ms.style.height=ms.offsetHeight;}}
else
{this.menuCont.style.height=document.getElementById('asylumNavLevel0').offsetHeight+'px';}
this.CreateBreadCrumbs();};AsylumNav.prototype.CreateClickUnder=function(navLink,active)
{if(typeof doneClickUnder=="undefined"){doneClickUnder=true;}else{return;}
if(document.getElementById("clickUnder")==null)return;obj=this;var linkId;if(this.layout=='Vertical')
{clickDiv=document.createElement('div');clickDiv.id="clickUnder";document.getElementById("clickUnder").appendChild(clickDiv);linkDiv=document.getElementById('asylumNavLinkDiv'+navLink.linkId);linkDiv.appendChild(clickDiv);}
else
{clickDiv=document.getElementById("clickUnder");}
var linkCount=0;for(linkId in this.menuItems[navLink.linkId])
{linkCount++;clickLinkDiv=document.createElement('div');clickLinkDiv.className='clickLinkDiv';clickLink=this.menuItems[navLink.linkId][linkId];txt=document.createTextNode(' ');clickDiv.appendChild(txt);a=document.createElement('a');a.id='asylumNavClickLink'+clickLink.linkId;a.className='clickLink';a.linkType='clickLink';a.linkId=linkId;a.levelId=clickLink.parentId;a.parentId=clickLink.parentId;if(clickLink.href==''||clickLink.href=='#'){a.href='#';a.target='';a.style.cursor='default';}else{a.href=clickLink.href;a.target=clickLink.target;}
if(this.layout=="Vertical"){a.innerHTML=clickLink.linkText;}else if(this.layout=="Horizontal-SubMenu"){if(clickLink.linkText.substring(0,1)==" "){a.innerHTML=clickLink.linkText.split(" ").join("&nbsp;");}else{a.innerHTML=clickLink.linkText;}}else{a.innerHTML=clickLink.linkText.split(" ").join("&nbsp;");}
a.onmouseover=function(){obj.HideAllLevels();obj.ShowLevel(this);};a.onmouseout=function(e){obj.HideLevel(e);};clickLinkDiv.appendChild(a);if(linkId==pageId)
{a.className='activeLink';clickLinkDiv.className+=' activeLink';}
clickDiv.appendChild(clickLinkDiv);txt=document.createTextNode(' ');clickDiv.appendChild(txt);}
if(linkCount==0||active==false)
{clickDiv.className='inactiveClickUnder';}
else
{clickDiv.className='activeClickUnder';}};AsylumNav.prototype.GetTopLevelLink=function(navLink)
{if(navLink.parentId=='0')
{return(navLink);}
while(1==1)
{navLink=this.GetParentLink(navLink);if(typeof navLink.parentId!='undefined')
{if(navLink.parentId=='0')
{break;}}}
return(navLink);};AsylumNav.prototype.GetParentLink=function(navLink)
{var levelId;var linkId;for(levelId in this.menuItems)
{for(linkId in this.menuItems[levelId])
{parNavLink=this.menuItems[levelId][linkId];if(parNavLink.linkId==navLink.parentId)
{return(parNavLink);}}}};AsylumNav.prototype.GetXPos=function(obj)
{var curleft=0;if(obj.offsetParent)
{while(obj.offsetParent&&obj.id!='navMenuCont')
{curleft+=obj.offsetLeft;obj=obj.offsetParent;}}
else if(obj.x)
curleft+=obj.x;return curleft;};AsylumNav.prototype.GetYPos=function(obj)
{var curtop=0;if(obj.offsetParent)
{while(obj.offsetParent&&obj.id!='navMenuCont')
{curtop+=obj.offsetTop;obj=obj.offsetParent;}}
else if(obj.y)
curtop+=obj.y;return curtop;};AsylumNav.prototype.ShowLevel=function(el)
{levelId=el.linkId;this.currentLevelId=levelId;window.clearTimeout(this.timeoutId);this.HideSubLevels(el.levelId);if(typeof this.menuItems[levelId]=='undefined')
{return;}
if(el.linkType=='clickLink')
{eP=document.getElementById('asylumNavClickLink'+el.linkId);eL=document.getElementById('asylumNavLevel'+levelId);SwapClass(eL,'subLevel','clickUnderSubLevel');}
else
{eP=document.getElementById('asylumNavLink'+levelId);eL=document.getElementById('asylumNavLevel'+levelId);SwapClass(eL,'clickUnderSubLevel','subLevel');}
if(eP.parentId=='0')
{switch(this.offset)
{case'Right':offsetX=(eP.offsetWidth);offsetY=0;break;case'Left':offsetX=(-eL.offsetWidth);offsetY=0;break;case'Bottom':offsetX=0;offsetY=eP.offsetHeight;eL.style.minWidth=eP.offsetWidth;break;}}
else
{switch(this.offset)
{case'Left':offsetX=(-eL.offsetWidth);offsetY=0;break;default:offsetX=(eP.offsetWidth);offsetY=0;break;}}
pX=this.GetXPos(eP);pY=this.GetYPos(eP);lX=pX+offsetX;lY=pY+offsetY;eL.style.position='absolute';$(eL).css({left:lX,top:lY});eL.style.visibility='visible';};AsylumNav.prototype.GetLevelWidth=function(levelId)
{maxWidth=0;for(linkId in this.menuItems[levelId])
{a=document.getElementById('asylumNavLink'+linkId);thisWidth=a.offsetWidth;if(thisWidth>maxWidth)
{maxWidth=thisWidth;}}
return(maxWidth);};AsylumNav.prototype.HideSubLevels=function(levelId,omitLevelId)
{if(typeof omitLevelId=='undefined')
{omitLevelId='0';}
eL=document.getElementById('asylumNavLevel'+levelId);for(levelId in eL.subLevels)
{this.HideSubLevels(levelId);if(levelId!=omitLevelId)
{eL=document.getElementById('asylumNavLevel'+levelId);eL.style.visibility='hidden';}}};AsylumNav.prototype.HideLevel=function(e)
{window.clearTimeout(this.timeoutId);if(!e)e=window.event;var el=(e.relatedTarget)?e.relatedTarget:e.toElement;var obj=this;var funct=function(){obj._HideLevel(el);};this.timeoutId=window.setTimeout(funct,1000);};AsylumNav.prototype._HideLevel=function(el)
{if(!el||el.id.substr(0,9)!='asylumNav'||(el.id.substr(0,9)=='asylumNav'&&el.style.visibility=='hidden'))
{this.HideAllLevels();}};AsylumNav.prototype.HideAllLevels=function()
{for(levelId in this.menuItems)
{if(levelId!='0')
{eL=document.getElementById('asylumNavLevel'+levelId);if(eL!=null)eL.style.visibility='hidden';}}};AsylumNav.prototype.CreateBreadCrumbs=function()
{if(document.getElementById("breadCrumbs")!=null)
{crumbsCont=document.getElementById("breadCrumbs");crumbsCont.style.display='none';crumbs='';homeLink='';for(levelId in this.menuItems)
{for(linkId in this.menuItems[levelId])
{navLink=this.menuItems[levelId][linkId];if(homeLink=='')
{homeLink='<a href="'+navLink.href+'" target="'+navLink.target+'">'
+navLink.linkText+'</a> &gt; ';}
if(linkId==pageId)
{i=0;parNavLink=this.GetParentLink(navLink);while(typeof parNavLink=='object')
{i++;crumbs='<a href="'+parNavLink.href+'" target="'+parNavLink.target+'">'
+parNavLink.linkText+'</a> &gt; '+crumbs;parNavLink=this.GetParentLink(parNavLink);}
if(i>1)
{crumbsCont.style.display='block';crumbsCont.innerHTML=homeLink+crumbs+'<span class="activeCrumb">'+navLink.linkText+'</span>';}
return(true);}}}}};function RemoveClass(el,className)
{var replaceName=(el.className.match(' '+className)?' '+className:className);el.className=el.className.replace(replaceName,'');};function AddClass(el,className)
{RemoveClass(el,className);el.className+=' '+className;};function SwapClass(el,removeClassName,addClassName)
{RemoveClass(el,removeClassName);AddClass(el,addClassName);};;$(function() {for (var i in tasks) {window.setTimeout(tasks[i], 0);}});function initMenu(){};$(function(){$("#navMenu").navmenu({pageInfo:{"a542692":{"P":0,"ID":548587,"C":542692,"O":0,"U":"http:\/\/www.rivervalley.co.nz\/","N":"Home","T":"_top","R":"","RT":"_blank"},"a595614":{"P":542692,"ID":595621,"C":595614,"O":"1","U":"http:\/\/www.rivervalley.co.nz\/by-water.html","N":"By Water","T":"_top","R":"","RT":"_blank"},"a595240":{"P":595614,"ID":595241,"C":595240,"O":"1","U":"http:\/\/www.rivervalley.co.nz\/search-river-valley-rafting.html","N":"Search for Rafting Trips","T":"_top","R":"","RT":"_blank"},"a542695":{"P":542692,"ID":544138,"C":542695,"O":"2","U":"http:\/\/www.rivervalley.co.nz\/river-valley-stables.html","N":"By Horse","T":"_top","R":"","RT":"_blank"},"a595527":{"P":542695,"ID":595528,"C":595527,"O":"1","U":"http:\/\/www.rivervalley.co.nz\/search-horse-riding.html","N":"Search for Horse Treks","T":"_top","R":"","RT":"_blank"},"a591744":{"P":542695,"ID":591746,"C":591744,"O":"2","U":"http:\/\/www.rivervalley.co.nz\/saddle-horse-team.html","N":"Saddle Horse Team","T":"_top","R":"","RT":"_blank"},"a591747":{"P":542695,"ID":591748,"C":591747,"O":"3","U":"http:\/\/www.rivervalley.co.nz\/saddle-horse-care.html","N":"Saddle Horse care","T":"_top","R":"","RT":"_blank"},"a544139":{"P":542692,"ID":544142,"C":544139,"O":"3","U":"http:\/\/www.rivervalley.co.nz\/aorangi-experiences-guided.html","N":"By Foot","T":"_top","R":"","RT":"_blank"},"a595612":{"P":544139,"ID":595613,"C":595612,"O":"1","U":"http:\/\/www.rivervalley.co.nz\/search-guided-hiking.html","N":"Search Hiking Options","T":"_top","R":"","RT":"_blank"},"a589405":{"P":542692,"ID":589408,"C":589405,"O":"4","U":"http:\/\/www.rivervalley.co.nz\/multi-sport-multi.html","N":"By Water &amp; Land","T":"_top","R":"","RT":"_blank"},"a595583":{"P":589405,"ID":595611,"C":595583,"O":"1","U":"http:\/\/www.rivervalley.co.nz\/search-multi-sport.html","N":"Search Water &amp; Land","T":"_top","R":"","RT":"_blank"},"a542693":{"P":542692,"ID":544130,"C":542693,"O":"5","U":"http:\/\/www.rivervalley.co.nz\/new-zealand-lodges.html","N":"The Lodge","T":"_top","R":"","RT":"_blank"},"a595577":{"P":542693,"ID":595581,"C":595577,"O":"1","U":"http:\/\/www.rivervalley.co.nz\/search-river-valley.html","N":"Search The Lodge","T":"_top","R":"","RT":"_blank"},"a590794":{"P":542693,"ID":590795,"C":590794,"O":"5","U":"http:\/\/www.rivervalley.co.nz\/restaurant-cafe-bar.html","N":"Restaurant, Cafe &amp; Bar","T":"_top","R":"","RT":"_blank"},"a600388":{"P":542692,"ID":600628,"C":600388,"O":"6","U":"http:\/\/www.rivervalley.co.nz\/river-valley-spa.html","N":" The Spa","T":"_top","R":"","RT":"_blank"},"a600679":{"P":600388,"ID":600680,"C":600679,"O":"1","U":"http:\/\/www.rivervalley.co.nz\/spa-sauna-yoga.html","N":"Search River Valley Spa","T":"_top","R":"","RT":"_blank"},"a542696":{"P":542692,"ID":544145,"C":542696,"O":"7","U":"http:\/\/www.rivervalley.co.nz\/river-valley-bookings.html","N":"To Book","T":"_top","R":"","RT":"_blank"},"a542697":{"P":542692,"ID":544148,"C":542697,"O":"8","U":"http:\/\/www.rivervalley.co.nz\/contacting-river-valley.html","N":"Contact Us","T":"_top","R":"","RT":"_blank"},"a544147":{"P":542692,"ID":544149,"C":544147,"O":"9","U":"http:\/\/www.rivervalley.co.nz\/river-valley-blog.html","N":"Blog","T":"_top","R":"","RT":"_blank"},"a596568":{"P":542692,"ID":596585,"C":596568,"O":"10","U":"http:\/\/www.rivervalley.co.nz\/about-river-valley.html","N":"About River Valley","T":"_top","R":"","RT":"_blank"},"a590498":{"P":596568,"ID":590499,"C":590498,"O":"1","U":"http:\/\/www.rivervalley.co.nz\/river-valley-staff.html","N":"About River Valley Staff","T":"_top","R":"","RT":"_blank"},"a590747":{"P":590498,"ID":590750,"C":590747,"O":"1","U":"http:\/\/www.rivervalley.co.nz\/catarafting-new-zealand.html","N":"Catarafting","T":"_top","R":"","RT":"_blank"},"a590753":{"P":590498,"ID":590759,"C":590753,"O":"2","U":"http:\/\/www.rivervalley.co.nz\/river-valley-homestead.html","N":"River Valley Homestead","T":"_top","R":"","RT":"_blank"},"a590698":{"P":596568,"ID":590699,"C":590698,"O":"2","U":"http:\/\/www.rivervalley.co.nz\/history-river-valley.html","N":"History of River Valley","T":"_top","R":"","RT":"_blank"},"a590762":{"P":596568,"ID":590763,"C":590762,"O":"3","U":"http:\/\/www.rivervalley.co.nz\/awards-accolades.html","N":"Awards &amp; Accolades","T":"_top","R":"","RT":"_blank"},"a590443":{"P":596568,"ID":594425,"C":590443,"O":"4","U":"http:\/\/www.rivervalley.co.nz\/subscribe-river-valley.html","N":"Newsletters","T":"_top","R":"","RT":"_blank"},"a591809":{"P":596568,"ID":593423,"C":591809,"O":"5","U":"http:\/\/www.rivervalley.co.nz\/guide-training.html","N":"Guide training","T":"_top","R":"","RT":"_blank"},"a591739":{"P":596568,"ID":591740,"C":591739,"O":"6","U":"http:\/\/www.rivervalley.co.nz\/employment-river-valley.html","N":"Employment","T":"_top","R":"","RT":"_blank"},"a590792":{"P":596568,"ID":590793,"C":590792,"O":"7","U":"http:\/\/www.rivervalley.co.nz\/tributes.html","N":"Tributes","T":"_top","R":"","RT":"_blank"}},alignment:"Vertical",animate:0})});